import pygame, math, random
from Controls import *
from Constants import *
import Game
# import Spawn, Particle
import Button


'''

notes/bugs/to-do


'''



class Transition(Game.Game):
	'''The game object.'''
	def __init__(self, size, loc, sound):
		'''Initializes the game.'''
		Game.Game.__init__(self, size, loc, sound)

		#game objects
		self.background = None

		#object lists
		self.buttons = []
		# self.spawns = []
		# self.bg_spawns = []
		# self.fg_spawns = []

		#hud
		#self.hud = Hud.Hud()

	def newlevel(self, leveldata=""):
		'''Interprets a loaded level file's data into a new level. Prepares objects for a new level.'''
		#reset game states
		self.leveldata = leveldata
		self.active = True
		self.endgame = False
		self.wingame = False
		self.pause = False
		self.reset = False

		#test stuff directly

		# self.spawns.append(Spawn.Spawn((320,240), Particle.Particle))

		# self.stuffs.append(Stuff.Stuff())

	def setpause(self, p):
		'''Pauses or unpauses the game.'''
		self.pause = False
		self.active = True

	def update(self, delta):
		'''Updates all game objects.'''
		# if self.reset:
			# return

		#interpret game-specific events
		# if new_events["lmb"]:
			# pass

		#game update
		

		#object update
		# for s in self.stuffs:
			# s.update()

		# for s in self.spawns:
			# s.update()

		#check game status
		# if win condition:
			# self.wingame = True
			# self.reset = True
			# self.active = False
		# elif lose condition:
			# self.reset = True
			# self.active = False

		#calculate camera displacement (for scrolling screens)
		# self.camdisp = (0,0)

		#post-update reset values
		pass

		#debug print everything
		#print len(self.stuffs)
		# p = 0
		# for s in self.spawns:
			# p += len(s.particles)
		# print p

	def draw(self, surf):
		'''Draws all game objects.'''
		self.camsurf.blit(black, self.camdisp)

		# for s in self.stuffs:
			# s.draw(self.camsurf, self.camdisp)

		surf.blit(self.camsurf, self.loc)
